<template>
	<!-- 
	停车券版本,授权获取手机
	 -->
	<view class="main-box" v-if="!isVerify">
		<view>
			<image id="form-box" mode="widthFix" class="bg-image" :src="imagePath + 'top.png'"></image>
			<view class="main-form-box">
				<!-- <xmly-submit-form :mobile="formData.mobile" :param="formData.param" :submit="formData.submit"
					:btnImg="imagePath + 'submit-btn.png'"></xmly-submit-form> -->

				<xmly-auto-get-mobile :mobile="formData.mobile" :param="formData.param" :submit="formData.submit"
					:btnImg="imagePath + 'submit-btn.png'"></xmly-auto-get-mobile>
			</view>
			<!-- <image mode="widthFix" class="bg-image" :src="imagePath + 'bottom.png'"></image> -->
		</view>
		<goto-form-fix-btn :btnImg="imagePath + 'submit-btn.png'" :targetId="scrollToTargetId"
			:scrollTop="scrollTop"></goto-form-fix-btn>
		<view class="rule-box" @click="isShowRule = true">
			<image class="rule-img" mode="widthFix" :src="imagePath + 'rule-icon.png'"></image>
		</view>
		<view v-if="isShowRule" class="rule-content-box">
			<image @click="isShowRule = false" class="rule-img" mode="widthFix" :src="imagePath + 'rule.png'"></image>
		</view>
		
	</view>
	<view v-else style="height: 100vh;display: flex;justify-content: center;align-items: center;color: #00000;">
		该功能暂未开通
	</view>


</template>

<script>
	import httpUtil from "@/utils/httpUtil";
	import userApi from "@/api/userApi.js"
	import ximaLayaShengHeApi from "../../api/ximaLayaShengHeApi";
	import commonApi from "../../api/commonApi";

	export default {
		data() {
			return {
				
				isShowRule: false,
				isVerify: false,
				scrollTop: 0,
				imagePath: 'https://h5.sx2b2c.com/images/tequan/ximalaya/0.01/',
				scrollToTargetId: "form-box",
				formData: {
					mobile: '',
					param: '',
					submit: 0,
				}
			}
		},
		onLoad(option) {
			this.initData(option)
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop
		},
		methods: {
			initData(option) {
				if (option.a) {
					httpUtil.setA(option.a)
				}
				if (option.param) {
					this.formData.param = option.param
					ximaLayaShengHeApi.setParam(option.param)
				}
				if (option.submit) {
					this.formData.submit = option.submit
				}

				userApi.getMiniLoginCode(code => {
					userApi.initUserId(code, res => {
						ximaLayaShengHeApi.buriedPoint()
					})
				})


				commonApi.isVerify(res => {
					this.isVerify = res
				})
				commonApi.is404()
			},
			
		}
	}
</script>

<style lang="scss">
	.main-box {
		background-color: #f9eee0;
		min-height: 100vh;
		padding-bottom: 20rpx;
	}

	.main-form-box {
		width: 90%;
		// position: absolute;
		// left: 5%;
		// bottom: 10vh;
		 margin: 10rpx auto 0;
	}

	.bg-image {
		width: 100%;
		height: auto;
	}

	.rule-box {
		position: fixed;
		top: 200rpx;
		right: 0;

		.rule-img {
			width: 40rpx;
			height: auto;
		}
	}

	.rule-content-box {
		position: fixed;
		width: 100%;
		height: 100vh;
		left: 0;
		top: 0;
		overflow: auto;
		z-index: 9;

		.rule-img {
			width: 100%;
			height: auto;
		}
	}
</style>